package com.solcoo.customer.ui.welcome;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;

import com.solcoo.customer.R;
import com.solcoo.customer.base.BaseActivity;
import com.solcoo.customer.model.Version;
import com.solcoo.customer.ui.login.LoginActivity;

public class WelComeActivity extends BaseActivity {
	private static final long DURATION_TIME = 2000L;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.welcome);
		Version.check();
		// 全屏
		this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		// 开启动画
		View logoBg = findViewById(R.id.welcome_view);
		Animation logoAnimation = AnimationUtils.loadAnimation(this,
				R.anim.welcome);
		logoAnimation.setDuration(DURATION_TIME);
		logoAnimation.setAnimationListener(mAnimationListener);
		logoBg.startAnimation(logoAnimation);
	}

	private AnimationListener mAnimationListener = new AnimationListener() {

		@Override
		public void onAnimationStart(Animation animation) {
		}

		@Override
		public void onAnimationRepeat(Animation animation) {
		}

		@Override
		public void onAnimationEnd(Animation animation) {
			Intent it = new Intent(WelComeActivity.this, LoginActivity.class);
			startActivity(it);
		}
	};
}
